feat(builtin): add ArrayView::strip_prefix and strip_suffix#3430
Merged
feat(builtin): add ArrayView::strip_prefix and strip_suffix#3430
Conversation
Collaborator
Coverage Report for CI Build 3943Coverage decreased (-0.002%) to 94.888%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
ce369b3 to
59ca09d
Compare
Mirror Array::strip_prefix / strip_suffix on ArrayView. The view variants return ArrayView[T]? (a sub-view) rather than allocating, matching the StringView precedent. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Mirror the String::strip_suffix / StringView::strip_suffix pattern: Array::strip_suffix now takes an ArrayView[T] suffix and returns ArrayView[T]?, delegating to ArrayView::strip_suffix. Avoids the allocate-and-blit cost when callers only need a view of the prefix.
59ca09d to
2d75cb6
Compare
Mirrors the strip_suffix migration so Array::strip_prefix takes ArrayView[T] and returns ArrayView[T]?, sharing the backing array instead of allocating. The doctests and tests switch to debug_inspect because Show for X? is deprecated in favor of Debug. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`moon info` now emits a separate top-level `fn Type::Type(..)` constructor for each `fn new(..)` declared inside a struct. These files were stale relative to the current toolchain, causing moon-info-check to fail. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This reverts commit 161e55c.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ArrayView::strip_prefixandArrayView::strip_suffix, returningArrayView[T]?.Array's versions (which allocate a new array), the view variants are O(1) sub-views — matching theStringViewprecedent.Test plan
moon fmt,moon check,moon infomoon test -p moonbitlang/core/builtin— 2746/2746 pass🤖 Generated with Claude Code